# -*- coding: utf-8 -*-
import xlrd
import pymongo
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )

data = xlrd.open_workbook('/Users/wuliao/Desktop/14.xlsx')

table = data.sheets()[0]

nrows = table.nrows

ncols = table.ncols

client = pymongo.MongoClient('175.102.18.112', 27018)

db_song = client.wuliao.song

ret = table.row_values(1115)
print ret

# for i in range(1,nrows):
#
#     ret = table.row_values(i)
#     item = {}
#     item['id'] = str(ret[0])[:-2]
#     # if(str(ret[1]).startswith("?") | str(ret[2]).startswith("?")):
#     #     print str(ret[1])+"..."+str(ret[2])
#
#     item['name'] = str(ret[1])
#     item['singer'] = str(ret[2])
#
#     try:
#         db_song.save(item)
#     except Exception:
#         print i
#
#
# # 1115
# # 20889
# # 26668
# # 36310
# # 41505
# # 62552
# # 63220
# # 70157
# # 80396
# # 86917
# # 91718
# # 95052
# # 160527